//导入 express
const express = require('express')

//导入解析验证规则的对象
const expressJoi = require('@escook/express-joi')

//导入验证规则
const {
    add_results_schema,
    update_results_schema,
    get_results_schema,
    delete_results_schema
} = require('../schema/results')

//创建路由实例
const router = express.Router()

//导入路由处理函数 
const resultsHandle = require('../router_handle/results')


//创建获取成绩信息的路由规则
router.get('/getallresults', resultsHandle.getAllResults)

//创建新增成绩信息的路由规则
router.post('/addresults', expressJoi(add_results_schema), resultsHandle.addResults)

//创建更新成绩信息的路由规则
router.post('/updateresults', expressJoi(update_results_schema), resultsHandle.updateResults)

//id获取成绩信息的路由规则
router.get('/getresults', expressJoi(get_results_schema), resultsHandle.getResultsById)

//创建删除成绩信息的路由规则
router.post('/deleteresults', expressJoi(delete_results_schema), resultsHandle.deleteResults)

// 创建根据成绩分类获取课程信息的路由函数
router.get('/getresults/cate', resultsHandle.getResultsByCate)

//向外共享router
module.exports = router